<?php

require_once(dirname(__FILE__)."/common.php");
//是否启用审核
$webconfig = lyg::readArr("web");
$check_enable = intval($webconfig['system_check'])===1?true:false;

if(empty($_REQUEST['m']) || intval($_REQUEST['m'])<1){lyg::showmsg('参数错误');}
$dataid = intval($_REQUEST['m']);


$_k = array();
$_v = array();

$_c = array();//分页条件
$_s = array();//搜索条件


if($_SESSION['eptime_adminPower']==2){

    $_k[]="#__money.id_login=?";
    $_v[]=intval($_SESSION['eptime_id']);
    $_c[]="id_login=".intval($_SESSION['eptime_id']);
    $_s['id_login'] = intval($_SESSION['eptime_id']);

	}
else{

if(!empty($_GET['id_login']) && intval($_GET['id_login'])>0){
    $_k[]="#__money.id_login=?";
    $_v[]=intval($_GET['id_login']);
    $_c[]="id_login=".intval($_GET['id_login']);
    $_s['id_login'] = intval($_GET['id_login']);
}
	}


$_k = implode(' and ',$_k);
if ($dataid==1){
if($_k!=''){
    $_k = " where ".$_k;
}
}


if ($dataid==2){
if($_k!=''){
    $_k = " where #__money_pay.price!=0 and #__money_pay.type!=2 and #__money_pay.type!=3 and #__money_pay.type!=4 and ".$_k;
}else{$_k = " where #__money_pay.price!=0 and #__money_pay.type!=2 and #__money_pay.type!=3 and #__money_pay.type!=4 ";}
}

$pagesize = 15;

if ($dataid==1){$datacount=$con->RowsCount("select count(#__money.id) from #__money  {$_k}",$_v);}
if ($dataid==2){$datacount=$con->RowsCount("select count(#__money_pay.id) from #__money_pay  {$_k}",$_v);}


$totalpages=LYG::getTotalPage($datacount,$pagesize);
$page=1;
if(!empty($_GET['p']) && intval($_GET['p'])>0){
	$page=intval($_GET['p']);
	if($page>$totalpages){echo "null";exit;}
	$page=$page>$totalpages?$totalpages:$page;
	if($page+1<=1){$page=1;}
	
}
$start_id=($page-1)*$pagesize;
if ($dataid==1){$sql = "select * from #__money {$_k} order by #__money.addtime desc,#__money.isok desc limit {$start_id},{$pagesize}";}
if ($dataid==2){$sql = "select * from #__money_pay {$_k} order by #__money_pay.id desc,#__money_pay.isok desc limit {$start_id},{$pagesize}";}
$data =$con->select($sql,$_v);

$fenye = LYG::getPageHtml($page,$datacount,$pagesize,$_c);

$sql = "select id,name from #__zhanghu; ";
$data2 =$con->select($sql);



?>
 
	<?php $i=0;foreach($data as $k=>$v){$i=$i+1?>
<?php if($i!=1){?>--hcSplitor--<?php }?><?php echo substr($v['selldate'],0,10);?> [<?php if ($dataid==1){echo $c_type["{$v['type']}"];} if ($dataid==2){echo $c_type1["{$v['type']}"];}?>]<?php echo c_bigclassname($v['id_bigclass']);?>-><?php echo c_smallclassname($v['id_smallclass']);?>
<a href="<?php if ($dataid==1){echo "money_show.php";} if ($dataid==2){echo "money_pay_show.php";}?>?id=<?php echo $v['id'];?>">
<div class="hui-list-info1">

<?php    	
    $searchValue = $v['zhanghu'];
	$r = array_filter($data2, function($t) use ($searchValue) { return $t['id'] == $searchValue; });
	if ($v['type']==0){     echo "<span style='color:red;'>";foreach($r as $rr){echo $rr["name"]." +";}; }if ($v['type']==1){   echo "<span style='color:#009900;'>"; foreach($r as $rr){echo $rr["name"]." -";};  }?><?php echo $v['price'];?>   元</span>
<span class="hui-icons hui-icons-right"></span>
</div>
</a>
<?php }?>